#ifndef __GRAY_SENSOR_H__
#define __GRAY_SENSOR_H__

#include "clock.h"
#include "ti_msp_dl_config.h"
#include "my_uart.h"

#define GET_NTH_BIT(sensor_value, nth_bit) (((sensor_value) >> ((nth_bit)-1)) & 0x01)
#define SEP_ALL_BIT8(sensor_value, val1, val2, val3, val4, val5, val6, val7, val8) \
do {                                                                              \
val1 = GET_NTH_BIT(sensor_value, 1);                                              \
val2 = GET_NTH_BIT(sensor_value, 2);                                              \
val3 = GET_NTH_BIT(sensor_value, 3);                                              \
val4 = GET_NTH_BIT(sensor_value, 4);                                              \
val5 = GET_NTH_BIT(sensor_value, 5);                                              \
val6 = GET_NTH_BIT(sensor_value, 6);                                              \
val7 = GET_NTH_BIT(sensor_value, 7);                                              \
val8 = GET_NTH_BIT(sensor_value, 8);                                              \
} while(0)



extern unsigned char Digtal;
extern unsigned char rx_buff[256];
extern uint8_t sensor_buffer[9];
extern float gw_offset;

void GW_proc(void);
uint8_t GW_Check_Sum(void);

#endif